<template>
    <section>
        <!--工具条-->
        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
            <el-form :inline="true" :model="filters">
                <el-form-item>
                    <el-input v-model="filters.name" placeholder="姓名"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="getProfile">查询</el-button>
                </el-form-item>
            </el-form>
        </el-col>
    
        <!--列表-->
        <template>
                    			<el-table :data="profiles" highlight-current-row v-loading="loading" style="width: 100%;">
                    				<el-table-column type="index" width="60">
                    				</el-table-column>
                    				<el-table-column prop="profile_name" label="配置名称" width="180" sortable>
                    				</el-table-column>
                    				<el-table-column prop="deploy_type" label="部署类型" width="120" sortable>
                    				</el-table-column>
                    				<el-table-column prop="project" label="项目" width="150" sortable>
                    				</el-table-column>
                    				<el-table-column prop="interface_type" label="接口类型" width="120" sortable>
                    				</el-table-column>
                    				<el-table-column label="操作" min-width="180">
                                        <template scope="scope">
                                            <el-button
                                            size="small"
                                            type="success"
                                            @click="processDeploy(scope.row)">开始部署</el-button>
                                        </template>
                				</el-table-column>
                			</el-table>
</template>

	</section>
</template>

<script>
    import {
        getDeployProfileList
    } from '../../api/api';
    //import NProgress from 'nprogress'
    export default {
        data() {
            return {
                filters: {
                    name: ''
                },
                loading: false,
                profiles: []
            }
        },
        methods: {
            processDeploy (params) {
                console.log('部署')
                console.log(params)
                this.$store.dispatch('updateCurrProfile', params)
                this.$router.push('/deploy')
            },
            //获取用户列表
            getProfile: function() {
                let para = {
                    name: this.filters.name
                };
                this.loading = true;
                //NProgress.start();
                getDeployProfileList(para).then((res) => {
                    console.log(res)
                    this.profiles = res.data;
                    this.loading = false;
                    //NProgress.done();
                });
            }
        },
        mounted() {
            this.getProfile();
        }
    };
</script>

<style scoped>
    
</style>